[LINUX][XENBUS] Drop (struct xenbus_device)->data, and simply use ->dev.driver_data
authorkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>
Fri, 9 Jun 2006 13:23:50 +0000 (14:23 +0100)
committerkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>
Fri, 9 Jun 2006 13:23:50 +0000 (14:23 +0100)
instead, since that's what it is there for.  Similar to patch
in patchqueue started by Jeremy, and expanded by me to include all
relevant drivers in xen-unstable.

Cc: Jeremy Fitzhardinge <jeremy@xensource.com>
Signed-off-by: Chris Wright <chrisw@sous-sol.org>
linux-2.6-xen-sparse/drivers/char/tpm/tpm_xen.c
linux-2.6-xen-sparse/drivers/xen/blkback/xenbus.c
linux-2.6-xen-sparse/drivers/xen/blkfront/blkfront.c
linux-2.6-xen-sparse/drivers/xen/netback/xenbus.c
linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c
linux-2.6-xen-sparse/drivers/xen/pciback/xenbus.c
linux-2.6-xen-sparse/drivers/xen/pcifront/xenbus.c
linux-2.6-xen-sparse/drivers/xen/tpmback/xenbus.c
linux-2.6-xen-sparse/include/xen/xenbus.h

index ff356f1342b8ba82d1935ff6451907c7855ab531..012e4bf51f22747862fe5427096604adb8e24ec7 100644 (file)
@@ -331,7 +331,7 @@ out:
 static void backend_changed(struct xenbus_device *dev,
                            enum xenbus_state backend_state)
 {
-       struct tpm_private *tp = dev->data;
+       struct tpm_private *tp = dev->dev.driver_data;
        DPRINTK("\n");
 
        switch (backend_state) {
@@ -380,12 +380,12 @@ static int tpmfront_probe(struct xenbus_device *dev,
        }
 
        tp->dev = dev;
-       dev->data = tp;
+       dev->dev.driver_data = tp;
 
        err = talk_to_backend(dev, tp);
        if (err) {
                tpm_private_put();
-               dev->data = NULL;
+               dev->dev.driver_data = NULL;
                return err;
        }
        return 0;
@@ -394,14 +394,14 @@ static int tpmfront_probe(struct xenbus_device *dev,
 
 static int tpmfront_remove(struct xenbus_device *dev)
 {
-       struct tpm_private *tp = (struct tpm_private *)dev->data;
+       struct tpm_private *tp = (struct tpm_private *)dev->dev.driver_data;
        destroy_tpmring(tp);
        return 0;
 }
 
 static int tpmfront_suspend(struct xenbus_device *dev)
 {
-       struct tpm_private *tp = (struct tpm_private *)dev->data;
+       struct tpm_private *tp = (struct tpm_private *)dev->dev.driver_data;
        u32 ctr;
 
        /* lock, so no app can send */
@@ -431,7 +431,7 @@ static int tpmfront_suspend(struct xenbus_device *dev)
 
 static int tpmfront_resume(struct xenbus_device *dev)
 {
-       struct tpm_private *tp = (struct tpm_private *)dev->data;
+       struct tpm_private *tp = (struct tpm_private *)dev->dev.driver_data;
        destroy_tpmring(tp);
        return talk_to_backend(dev, tp);
 }
index 3e305f743a539224e0c09ed24d45a8da6f30c00f..ae92133a02cce95044e0d3905b69a2a95fcdd8d9 100644 (file)
@@ -77,7 +77,7 @@ static ssize_t show_physical_device(struct device *_dev,
                                    struct device_attribute *attr, char *buf)
 {
        struct xenbus_device *dev = to_xenbus_device(_dev);
-       struct backend_info *be = dev->data;
+       struct backend_info *be = dev->dev.driver_data;
        return sprintf(buf, "%x:%x\n", be->major, be->minor);
 }
 DEVICE_ATTR(physical_device, S_IRUSR | S_IRGRP | S_IROTH,
@@ -88,7 +88,7 @@ static ssize_t show_mode(struct device *_dev, struct device_attribute *attr,
                         char *buf)
 {
        struct xenbus_device *dev = to_xenbus_device(_dev);
-       struct backend_info *be = dev->data;
+       struct backend_info *be = dev->dev.driver_data;
        return sprintf(buf, "%s\n", be->mode);
 }
 DEVICE_ATTR(mode, S_IRUSR | S_IRGRP | S_IROTH, show_mode, NULL);
@@ -96,7 +96,7 @@ DEVICE_ATTR(mode, S_IRUSR | S_IRGRP | S_IROTH, show_mode, NULL);
 
 static int blkback_remove(struct xenbus_device *dev)
 {
-       struct backend_info *be = dev->data;
+       struct backend_info *be = dev->dev.driver_data;
 
        DPRINTK("");
 
@@ -116,7 +116,7 @@ static int blkback_remove(struct xenbus_device *dev)
        device_remove_file(&dev->dev, &dev_attr_mode);
 
        kfree(be);
-       dev->data = NULL;
+       dev->dev.driver_data = NULL;
        return 0;
 }
 
@@ -138,7 +138,7 @@ static int blkback_probe(struct xenbus_device *dev,
                return -ENOMEM;
        }
        be->dev = dev;
-       dev->data = be;
+       dev->dev.driver_data = be;
 
        be->blkif = blkif_alloc(dev->otherend_id);
        if (IS_ERR(be->blkif)) {
@@ -249,7 +249,7 @@ static void backend_changed(struct xenbus_watch *watch,
 static void frontend_changed(struct xenbus_device *dev,
                             enum xenbus_state frontend_state)
 {
-       struct backend_info *be = dev->data;
+       struct backend_info *be = dev->dev.driver_data;
        int err;
 
        DPRINTK("");
index d7d408082ae111fc5cddfcfe8f3d04ff98f51015..2473ea82d8fc66d786dfc9602e8bd404ad5ff419 100644 (file)
@@ -107,12 +107,12 @@ static int blkfront_probe(struct xenbus_device *dev,
 
        /* Front end dir is a number, which is used as the id. */
        info->handle = simple_strtoul(strrchr(dev->nodename,'/')+1, NULL, 0);
-       dev->data = info;
+       dev->dev.driver_data = info;
 
        err = talk_to_backend(dev, info);
        if (err) {
                kfree(info);
-               dev->data = NULL;
+               dev->dev.driver_data = NULL;
                return err;
        }
 
@@ -128,7 +128,7 @@ static int blkfront_probe(struct xenbus_device *dev,
  */
 static int blkfront_resume(struct xenbus_device *dev)
 {
-       struct blkfront_info *info = dev->data;
+       struct blkfront_info *info = dev->dev.driver_data;
        int err;
 
        DPRINTK("blkfront_resume: %s\n", dev->nodename);
@@ -249,7 +249,7 @@ fail:
 static void backend_changed(struct xenbus_device *dev,
                            enum xenbus_state backend_state)
 {
-       struct blkfront_info *info = dev->data;
+       struct blkfront_info *info = dev->dev.driver_data;
        struct block_device *bd;
 
        DPRINTK("blkfront:backend_changed.\n");
@@ -341,7 +341,7 @@ static void connect(struct blkfront_info *info)
  */
 static void blkfront_closing(struct xenbus_device *dev)
 {
-       struct blkfront_info *info = dev->data;
+       struct blkfront_info *info = dev->dev.driver_data;
 
        DPRINTK("blkfront_closing: %s removed\n", dev->nodename);
 
@@ -353,7 +353,7 @@ static void blkfront_closing(struct xenbus_device *dev)
 
 static int blkfront_remove(struct xenbus_device *dev)
 {
-       struct blkfront_info *info = dev->data;
+       struct blkfront_info *info = dev->dev.driver_data;
 
        DPRINTK("blkfront_remove: %s removed\n", dev->nodename);
 
index ffa492370643b0b1ae7af40225518f47490e4da1..5184584979ffa0d2b205d2b18b47a48426630d78 100644 (file)
@@ -44,7 +44,7 @@ static void backend_changed(struct xenbus_watch *, const char **,
 
 static int netback_remove(struct xenbus_device *dev)
 {
-       struct backend_info *be = dev->data;
+       struct backend_info *be = dev->dev.driver_data;
 
        if (be->backend_watch.node) {
                unregister_xenbus_watch(&be->backend_watch);
@@ -56,7 +56,7 @@ static int netback_remove(struct xenbus_device *dev)
                be->netif = NULL;
        }
        kfree(be);
-       dev->data = NULL;
+       dev->dev.driver_data = NULL;
        return 0;
 }
 
@@ -81,7 +81,7 @@ static int netback_probe(struct xenbus_device *dev,
        }
 
        be->dev = dev;
-       dev->data = be;
+       dev->dev.driver_data = be;
 
        err = xenbus_watch_path2(dev, dev->nodename, "handle",
                                 &be->backend_watch, backend_changed);
@@ -134,7 +134,7 @@ fail:
 static int netback_uevent(struct xenbus_device *xdev, char **envp,
                          int num_envp, char *buffer, int buffer_size)
 {
-       struct backend_info *be = xdev->data;
+       struct backend_info *be = xdev->dev.driver_data;
        netif_t *netif = be->netif;
        int i = 0, length = 0;
        char *val;
@@ -213,7 +213,7 @@ static void backend_changed(struct xenbus_watch *watch,
 static void frontend_changed(struct xenbus_device *dev,
                             enum xenbus_state frontend_state)
 {
-       struct backend_info *be = dev->data;
+       struct backend_info *be = dev->dev.driver_data;
 
        DPRINTK("");
 
index 99649fa3967f77fe3716e60e24a586c46587e412..73c512856892220d19fdbff1db47ade1fba8d4d5 100644 (file)
@@ -207,14 +207,14 @@ static int __devinit netfront_probe(struct xenbus_device *dev,
        }
 
        info = netdev_priv(netdev);
-       dev->data = info;
+       dev->dev.driver_data = info;
 
        err = talk_to_backend(dev, info);
        if (err) {
                xennet_sysfs_delif(info->netdev);
                unregister_netdev(netdev);
                free_netdev(netdev);
-               dev->data = NULL;
+               dev->dev.driver_data = NULL;
                return err;
        }
 
@@ -230,7 +230,7 @@ static int __devinit netfront_probe(struct xenbus_device *dev,
  */
 static int netfront_resume(struct xenbus_device *dev)
 {
-       struct netfront_info *info = dev->data;
+       struct netfront_info *info = dev->dev.driver_data;
 
        DPRINTK("%s\n", dev->nodename);
 
@@ -394,7 +394,7 @@ static int setup_device(struct xenbus_device *dev, struct netfront_info *info)
 static void backend_changed(struct xenbus_device *dev,
                            enum xenbus_state backend_state)
 {
-       struct netfront_info *np = dev->data;
+       struct netfront_info *np = dev->dev.driver_data;
        struct net_device *netdev = np->netdev;
 
        DPRINTK("\n");
@@ -1475,7 +1475,7 @@ inetdev_notify(struct notifier_block *this, unsigned long event, void *ptr)
  */
 static void netfront_closing(struct xenbus_device *dev)
 {
-       struct netfront_info *info = dev->data;
+       struct netfront_info *info = dev->dev.driver_data;
 
        DPRINTK("netfront_closing: %s removed\n", dev->nodename);
 
@@ -1487,7 +1487,7 @@ static void netfront_closing(struct xenbus_device *dev)
 
 static int __devexit netfront_remove(struct xenbus_device *dev)
 {
-       struct netfront_info *info = dev->data;
+       struct netfront_info *info = dev->dev.driver_data;
 
        DPRINTK("%s\n", dev->nodename);
 
index 672a2f7fbc838f6a1d3e655867f07e39000cbd5a..e4228c7689042f8c2ae70074cb5087b96b6b5aa3 100644 (file)
@@ -23,7 +23,7 @@ static struct pciback_device *alloc_pdev(struct xenbus_device *xdev)
        dev_dbg(&xdev->dev, "allocated pdev @ 0x%p\n", pdev);
 
        pdev->xdev = xdev;
-       xdev->data = pdev;
+       xdev->dev.driver_data = pdev;
 
        spin_lock_init(&pdev->dev_lock);
 
@@ -61,7 +61,7 @@ static void free_pdev(struct pciback_device *pdev)
 
        pciback_release_devices(pdev);
 
-       pdev->xdev->data = NULL;
+       pdev->xdev->dev.driver_data = NULL;
        pdev->xdev = NULL;
 
        kfree(pdev);
@@ -168,7 +168,7 @@ static int pciback_attach(struct pciback_device *pdev)
 static void pciback_frontend_changed(struct xenbus_device *xdev,
                                     enum xenbus_state fe_state)
 {
-       struct pciback_device *pdev = xdev->data;
+       struct pciback_device *pdev = xdev->dev.driver_data;
 
        dev_dbg(&xdev->dev, "fe state changed %d\n", fe_state);
 
@@ -421,7 +421,7 @@ static int pciback_xenbus_probe(struct xenbus_device *dev,
 
 static int pciback_xenbus_remove(struct xenbus_device *dev)
 {
-       struct pciback_device *pdev = dev->data;
+       struct pciback_device *pdev = dev->dev.driver_data;
 
        if (pdev != NULL)
                free_pdev(pdev);
index dbd672431b55a962160d2065cbb1dab4fde40beb..9d2df89a2f11b4261a4238c8873ce1c81878cc90 100644 (file)
@@ -29,7 +29,7 @@ static struct pcifront_device *alloc_pdev(struct xenbus_device *xdev)
        }
        pdev->sh_info->flags = 0;
 
-       xdev->data = pdev;
+       xdev->dev.driver_data = pdev;
        pdev->xdev = xdev;
 
        INIT_LIST_HEAD(&pdev->root_buses);
@@ -59,7 +59,7 @@ static void free_pdev(struct pcifront_device *pdev)
                gnttab_end_foreign_access(pdev->gnt_ref, 0,
                                          (unsigned long)pdev->sh_info);
 
-       pdev->xdev->data = NULL;
+       pdev->xdev->dev.driver_data = NULL;
 
        kfree(pdev);
 }
@@ -216,7 +216,7 @@ static int pcifront_try_disconnect(struct pcifront_device *pdev)
 static void pcifront_backend_changed(struct xenbus_device *xdev,
                                     enum xenbus_state be_state)
 {
-       struct pcifront_device *pdev = xdev->data;
+       struct pcifront_device *pdev = xdev->dev.driver_data;
 
        switch (be_state) {
        case XenbusStateClosing:
@@ -261,8 +261,8 @@ static int pcifront_xenbus_probe(struct xenbus_device *xdev,
 
 static int pcifront_xenbus_remove(struct xenbus_device *xdev)
 {
-       if (xdev->data)
-               free_pdev(xdev->data);
+       if (xdev->dev.driver_data)
+               free_pdev(xdev->dev.driver_data);
 
        return 0;
 }
index b5817ff663d63d1e525706ab3965959218ac11fc..291e7b3a68b0a07ee16b4881211e367992680b87 100644 (file)
@@ -47,7 +47,7 @@ static void frontend_changed(struct xenbus_device *dev,
 
 static int tpmback_remove(struct xenbus_device *dev)
 {
-       struct backend_info *be = dev->data;
+       struct backend_info *be = dev->dev.driver_data;
 
        if (!be) return 0;
 
@@ -62,7 +62,7 @@ static int tpmback_remove(struct xenbus_device *dev)
                be->tpmif = NULL;
        }
        kfree(be);
-       dev->data = NULL;
+       dev->dev.driver_data = NULL;
        return 0;
 }
 
@@ -81,7 +81,7 @@ static int tpmback_probe(struct xenbus_device *dev,
 
        be->is_instance_set = 0;
        be->dev = dev;
-       dev->data = be;
+       dev->dev.driver_data = be;
 
        err = xenbus_watch_path2(dev, dev->nodename,
                                "instance", &be->backend_watch,
@@ -131,7 +131,7 @@ static void backend_changed(struct xenbus_watch *watch,
 static void frontend_changed(struct xenbus_device *dev,
                              enum xenbus_state frontend_state)
 {
-       struct backend_info *be = dev->data;
+       struct backend_info *be = dev->dev.driver_data;
        int err;
 
        be->frontend_state = frontend_state;
index a944dfdf4ef378d90b24eee033bfc72c3138a90a..639f3e17f548c3feb9c6aa381cb9f6c7329056cd 100644 (file)
@@ -76,7 +76,6 @@ struct xenbus_device {
        struct xenbus_watch otherend_watch;
        struct device dev;
        enum xenbus_state state;
-       void *data;
 };
 
 static inline struct xenbus_device *to_xenbus_device(struct device *dev)